<form action="{{url:site uri='business/private/update'}}/{{model:id}}" method="post" class="form_input" >
	<input type="hidden" value="{{user:id}}" name="user_id" />
	<button name="btnAction" value="save" style="display:none;">Save</button>
</form>

<div class="con">
<div class="time">
<p>{{helper:date format = 'd-m-Y' timestamp = model:date_start}}</p> 
<p>{{helper:date format = 'd-m-Y' timestamp = model:date_end}}</p>
</div>
</div>
<div class="fl" style="width:40%;overflow: hidden;">


<div class="con">
<h3>{{ helper:lang line = 'private:report' }}</h3>
{{if !model:status }}
<a class="finish" title="{{ helper:lang line = 'private:finish' }}" href="{{ url:site uri = 'business/private/finish/{{model:id}}' }}">{{ helper:lang line = 'private:finish' }}</a>
{{else}}
<h5 style="color:#f00">{{ helper:lang line = 'private:finish_report' }}</h5>
{{endif}}
{{if notes}}
<ul class="list-comment">
<?php foreach ($notes as $item){ 
$cl = "";
if (!empty($item->file)) 
	$cl = "hasfile";
?>
<li class="item-comment <?php echo $cl?>">
<?php if (!empty($item->file)) { ?>
	<a title="{{ helper:lang line = 'project:file_att' }}" target="_blank" class="attach-icon fl" href="{{url:site uri = '<?php echo 'uploads/files/'.$item->username.'/'.$item->file ?>'}}" >
		{{ helper:lang line = 'project:file_att' }}
	</a>
<?php } ?>
<small {{ if {helper:date format='d-m-Y' timestamp = '<?php echo $item->id;?>'} == '<?php echo date("d-m-Y");?>' }} style="color:#F00" {{endif}}>{{helper:date format='d-m-Y H:i' timestamp = '<?php echo $item->id;?>'}} </small> 
<p class="clr"><?php echo nl2br($item->note) ?></p>

</li>
<?php } ?>
</ul>
{{endif}}
<a class="readmore cl bg-user" title="{{ helper:lang line = 'comment:readmore' }}">{{ helper:lang line = 'comment:readmore' }}</a>
{{if !model:status }}
<form id="comment" method="post" action="{{url:site uri='business/private/append_note'}}" enctype="multipart/form-data" >
	<input type="hidden" value="{{model:id}}" name="private_id" />
	<input type="hidden" value="" name="file" id="file_append" />
	
	<div class="errors">  </div>
	
	<div style="" class="input"><textarea class="editor" name="note" style="width:97%;resize:none;" rows="6" ></textarea></div>
	
	<div><p class="file_name fl"></p></div>
	
	
	
	<div class="clr">
		<button class="btn bg-user">{{ helper:lang line = 'project:send' }}</button>
	</div>
</form>
{{endif}}
<form id="frm_upload_file" method="post" action="{{url:site uri='business/upload'}}" enctype="multipart/form-data" >

<div style="display:none">File: <input type="file" class="upload_file" name="upload" /></div>
<!--<a class="file_att btn bg-user fl" href="javascript:void(0)" >{{ helper:lang line = 'project:file_att' }}</a>-->
</form>
<script type="text/javascript">

var comment;
$('#comment .btn').click(function(){
	if(comment!=null)
		comment.abort();
	comment = $.ajax({
		url:$('#comment').attr('action'),
		data:$('#comment').serialize(),
		type:'post',
		dataType:'json',
		success: function(data){
			if(data.error){
				$('div.errors').addClass('alert').html('').append(data.error);
			}
			else{
				$('form#comment textarea').val('');
				location.reload();
			}
		}
	});
	return false;
});									
								
</script>
</div>


</div>
<div class="fr" style="width:55%;border-left:1px solid #ccc;padding-left:10px">
<div class="con">
<h3>{{ helper:lang line = 'project:description' }}</h3>
{{model:description}}
</div>
</div>

<div class="line"></div>

<script type="text/javascript">
$num = 8; //so comment hien thi	
$items = $('.item-comment');
$items.hide();

$items.slice(0,$num).fadeIn(600);
$('a.readmore').click(function(){
	$cu = $('.item-comment:hidden');
	if($cu.length> 0 ){
		$cu.slice(0,$num).fadeIn(600);
	}
	else
		$(this).hide();
});
$option = {
	status: true,
	b : true,i: true,u: true,br : true,button: true,center: true,
	fsizes: true,title: true,color: true,link:true,unlink: true,
	//false
	format: false,funit: false,linktypes: false,left: false,	ul: false,ol: false,
	remove: false,right: false,rule: false,source: false,sub: false,strike: false,p: false,
	sup: false,	placeholder: false,indent: false,outdent: false,fsize: false
};
$(".editor").jqte($option);
$('a.file_att').click(function(){
	$('input.upload_file').trigger('click');
});

$('a.finish').click(function(){
	$mes = confirm('{{helper:lang line="private:finish_end"}}');
	if($mes == true){
		return true;
	}
	return false;
});
</script>